package com.alex.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.format.annotation.NumberFormat;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Past;
import java.util.Date;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class User {

    private Integer id;

    @NotEmpty
    private String name;

    @Email
    private String email;

    @NumberFormat(pattern = "#,#.#")
    private Double salary;

    @Past
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date birth;

    public User(String name, String email) {
        this.name = name;
        this.email = email;
    }

    public User(String name, String email, Date birth) {
        this.name = name;
        this.email = email;
        this.birth = birth;
    }
}
